#ifndef FUNCTION_H
#define FUNCTION_H

#include "sys.h"
//copy src to des end if (0x0d 0x0a)
extern void fc_copy_line_1(char* src,char* des);
//get the point start without (0x0d 0x0a)
extern char* fc_get_line_1(char* src);

extern void fc_char2hex(uint8_t *pbSrc, uint8_t *pbDest, int srcLen);	
extern void fc_hex2char(uint8_t *pbSrc, uint8_t *pbDest, int srcLen);
extern uint16_t fc_calculate_crc16(uint8_t *pBuf,uint16_t value, uint32_t size);
extern uint16_t fc_calculate_crc16_modbus(uint8_t *pBuf, uint16_t size);
extern uint16_t fc_get_crc16(uint16_t reg_init, const uint8_t* data, uint16_t length);
extern uint16_t fc_crc16_ccitt(uint16_t reg_init, const uint8_t* data, uint16_t length);
extern uint16_t fc_crc16_modemx(uint16_t reg_init, const uint8_t* data, uint16_t length);
extern uint8_t fc_get_xor(uint8_t init,uint8_t* data,uint16_t datalen);
extern uint8_t fc_array_is_value(uint8_t* ptbuf, uint8_t value, uint16_t size);
extern uint8_t fc_mem_compare(uint8_t* mem1, uint8_t* mem2, uint16_t length);
// bootloader
extern uint8_t fc_get_sum(uint8_t* data,uint16_t datalen);
extern uint8_t fc_read_line(uint8_t* src,uint16_t srclen,char* _line);
extern uint8_t fc_is_flash_init(uint8_t* ptbuf, uint16_t size);
extern uint32_t fc_hexstring_to_int(char *string);
extern uint32_t fc_atoi(char *string);

#endif
